package cn.snowheart.singleton;

/**
 * 饿汉模式，类加载即初始化单例对象，无线程安全问题
 *
 * @author liuwanxiang
 * @version 2019/07/02
 */
public class SingletonV1 {

    private static SingletonV1 singletonV1 = new SingletonV1();

    private int value;

    private SingletonV1() {
        value = 0;
    }

    public int increase() {
        return value++;
    }

    public static SingletonV1 getInstance() {
        return singletonV1;
    }

}
